From 25108fcc012a19f10f7323bf4b790c4e83ae3945 Mon Sep 17 00:00:00 2001 From: robertl Date: Sun, 15 Dec 2002 23:05:07 +0000 Subject: [PATCH] Correctly parse lat/lon from magellan track messasges. --- magproto.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/magproto.c b/magproto.c index af0396e25..e9a252c25 100644 --- a/magproto.c +++ b/magproto.c @@ -36,6 +36,7 @@ extern gpsdata_type objective; static char * termread(char *ibuf, int size); static void termwrite(char *obuf, int size); +static double mag2degrees(double mag_val); typedef enum { mrs_handoff = 0, @@ -753,8 +754,12 @@ mag_trkparse(char *trkmsg) */ waypt->creation_time = mktime(&tm); - waypt->position.latitude.degrees = latdeg / 100.0; - waypt->position.longitude.degrees = lngdeg / 100.0; + if (latdir == 'S') latdeg = -latdeg; + waypt->position.latitude.degrees = mag2degrees(latdeg); + + if (lngdir == 'W') lngdeg = -lngdeg; + waypt->position.longitude.degrees = mag2degrees(lngdeg); + waypt->position.altitude.altitude_meters = alt; return waypt; -- 2.30.2